<template>
    <div>
        <nav-bar>
            <template v-slot:default>
                账号管理
            </template>
        </nav-bar>
        <div class="account">
            <van-cell title="用户账户" is-link :value="user.email"/>

            <van-cell @click="updatePassword" title="修改登入密码" is-link value=""/>
        </div>

    </div>
</template>
<style>
.account{
    margin-top: 45px;

}
.van-cell__title{
    text-align: left;
}
</style>
<script>
import NavBar from '@/components/common/NavBar/NavBar.vue';
import { getUser } from '@/network/user';
import { reactive,toRefs } from 'vue';
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
export default({
    name:'Account',
    components:{
        NavBar
    },
    setup(){
        const state = reactive({
            user:{}
        })
        const router = useRouter();
       onMounted(()=>{
        getUser().then(res=>{
            console.log(res);
            state.user = res;
        })
       })
        const updatePassword=()=>{
            router.push('/updatepwd')
        }
       
        return{
          ...toRefs(state),
            updatePassword,
           
        }
    }
})
</script>
<!-- account:账户 -->